package jwt

import (
	"Junior_two/subject/usercenter/userrpc/pb/user"
	"context"

	"Junior_two/subject/usercenter/userapi/internal/svc"
	"Junior_two/subject/usercenter/userapi/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

type UserInfoLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewUserInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UserInfoLogic {
	return &UserInfoLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *UserInfoLogic) UserInfo(req *types.UserInfoReq) (resp *types.UserInfoResp, err error) {
	// todo: add your logic here and delete this line
	u, _ := l.svcCtx.UserServer.UserInfo(l.ctx, &user.UserRequest{Username: req.Username})
	return &types.UserInfoResp{
		Msg:  "用户信息查询成功",
		Data: u.Data,
	}, nil
}
